package cn.kent.controller;

import cn.kent.util.KafkaUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/kafka")
public class KafkaController {

    @Autowired
    private KafkaUtil kafkaUtil;
    private static final String topic = "test";

    @RequestMapping("/send")
    public String send() {
        String msg = "hello, consumer!";
        kafkaUtil.send(topic, msg);
        return "send success.";
    }

    @RequestMapping("/health")
    public String test() {
        return "hello";
    }
}
